﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using MMO_MANAGER.BUS;

namespace MMO_MANAGER.FORM_CATALOG
{
    public partial class ChannelDlg : DevExpress.XtraEditors.XtraForm
    {
        email_list_bus bus_email = new email_list_bus();
        gpage_list_bus bus_gpl = new gpage_list_bus();
        label_list_bus bus_lb = new label_list_bus();
        ga_list_bus bus_ga = new ga_list_bus();

        public ChannelDlg()
        {
            InitializeComponent();
            LoadCB();
        }

        public int EmailPrimary
        {
            get { return Convert.ToInt16(cbb_email_primary.EditValue); }
            set { cbb_email_primary.EditValue = value; }
        }

        public int YoutubeAcc
        {
            get { return Convert.ToInt16(cbb_yt_acc.EditValue); }
            set { cbb_yt_acc.EditValue = value; }
        }

        public string Channel
        {
            get { return txt_channel.Text; }
            set { txt_channel.Text = value; }
        }

        public int LabelName
        {
            get { return Convert.ToInt16(cbb_label.EditValue); }
            set { cbb_label.EditValue = value; }
        }

        public int EmailGA
        {
            get { return Convert.ToInt16(cbb_ga_email.EditValue); }
            set { cbb_ga_email.EditValue = value; }
        }

        public string Note
        {
            get { return txt_note.Text; }
            set { txt_note.Text = value; }
        }

        void LoadCB()
        {
            // - Load Email
            cbb_email_primary.Properties.DataSource = bus_email.GetData();
            cbb_email_primary.Properties.DisplayMember = "ten";
            cbb_email_primary.Properties.ValueMember = "id";
            // - Load Gpage+
            cbb_yt_acc.Properties.DataSource = bus_gpl.GetData();
            cbb_yt_acc.Properties.DisplayMember = "ten";
            cbb_yt_acc.Properties.ValueMember = "id";
            // - Load Label
            cbb_label.Properties.DataSource = bus_lb.GetData();
            cbb_label.Properties.DisplayMember = "ten";
            cbb_label.Properties.ValueMember = "id";
            // - Load GA
            cbb_ga_email.Properties.DataSource = bus_ga.GetData();
            cbb_ga_email.Properties.DisplayMember = "tenga";
            cbb_ga_email.Properties.ValueMember = "id";
        }

        private void ChannelDlg_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Close();
            }
        }

    }
}